<template>
  <view class="contract-item">
    <view class="item-top">
      <view class="item-location">{{location}}</view>
      <view class="item-status" :class="{'status-fixing': statusType === 'fixing'}">{{status}}</view>
    </view>
    <view class="divider"></view>
    <view class="item-bottom">
      <view class="item-info">
        <text class="item-name">{{name}}</text>
        <text class="item-phone">{{phone}}</text>
      </view>
      <view class="item-action">
        <button 
          class="action-button" 
          :class="{'button-danger': actionType === 'danger'}"
          @click="$emit('action')"
        >{{actionText}}</button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'ContractItem',
  props: {
    location: {
      type: String,
      required: true
    },
    name: {
      type: String,
      required: true
    },
    phone: {
      type: String,
      required: true
    },
    status: {
      type: String,
      required: true
    },
    statusType: {
      type: String,
      default: 'default'
    },
    actionText: {
      type: String,
      default: '邀请绑定'
    },
    actionType: {
      type: String,
      default: 'default'
    }
  }
}
</script>

<style lang="scss" scoped>
.contract-item {
  background-color: #fff;
  border-radius: 12rpx;
  padding: 24rpx;
  margin-bottom: 20rpx;
  
  .item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20rpx;
  }
  
  .item-location {
    font-size: 28rpx;
    color: #333;
    font-weight: 500;
  }
  
  .divider {
    height: 1rpx;
    background-color: #eee;
    margin: 20rpx 0;
  }
  
  .item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .item-info {
    .item-name {
      font-size: 26rpx;
      color: #666;
      margin-right: 20rpx;
    }
    
    .item-phone {
      font-size: 26rpx;
      color: #999;
    }
  }
  
  .item-status {
    font-size: 24rpx;
    color: #1890ff;
    padding: 4rpx 12rpx;
    border-radius: 4rpx;
    
    &.status-fixing {
      color: #f5222d;
      background-color: #fff1f0;
    }
  }
  
  .action-button {
    font-size: 24rpx;
    color: #1890ff;
    background-color: #fff;
    border: 1rpx solid #1890ff;
    border-radius: 30rpx;
    padding: 8rpx 24rpx;
    line-height: 1.5;
    
    &.button-danger {
      color: #f5222d;
      border-color: #f5222d;
    }
  }
}
</style>